<form id="<?php echo $com->Id; ?>_editor_contacts" action="<?php echo $katana->getFormAction(); ?>" method="post" enctype="multipart/form-data" name="editor_contacts">
<input id="action" type="hidden" name="action" value="editor_contacts" />
<input id="delContact" type="hidden" name="delContact" value="0" />
<table cellpadding="0" cellspacing="0" border="0" class="zebra com_list">
	<thead class="fields">
		<tr class="title">
			<th class="first left vtop" colspan="4"><h3><?php echo ucfirst($txt->getWord('contact_persons')); ?></h3></th>
			<th class="last vtop">&nbsp;</th>
		</tr>
		<tr>
			<th class="first left"><?php echo ucfirst($txt->getWord('name', $words)); ?>&nbsp;&nbsp;&nbsp;&nbsp;</th>
			<th class="left"><?php echo ucfirst($txt->getWord('lastname', $words)); ?>&nbsp;&nbsp;&nbsp;&nbsp;</th>
			<th class="left"><?php echo ucfirst($txt->getWord('e-mail', $words)); ?>&nbsp;&nbsp;&nbsp;&nbsp;</th>
			<th class="left"><?php echo ucfirst($txt->getWord('mobile', $words)); ?>&nbsp;&nbsp;&nbsp;&nbsp;</th>
			<th class="nosort last"><?php echo ucfirst($txt->getWord('add', $words)); ?>&nbsp;/&nbsp;<?php echo ucfirst($txt->getWord('delete', $words)); ?></th>
		</tr>
	</thead>
	<tbody>
	<tr class="items">
		<td class="first vtop"><?php echo $forms['new_contact']->getFieldHTML('newContactName', 'table_cell');?>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td class="vtop"><?php echo $forms['new_contact']->getFieldHTML('newContactLastName', 'table_cell');?>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td class="vtop"><?php echo $forms['new_contact']->getFieldHTML('newContactEmail', 'table_cell');?>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td class="vtop"><?php echo $forms['new_contact']->getFieldHTML('newContactPhone', 'table_cell');?>&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td class="last center vtop"><img title="<?php echo ucfirst($txt->getWord('add', $words).' '.$txt->getWord('new', $words).' '.$txt->getWord('contact', $words)); ?>"
										class="icon command" 
										src="<?php echo SYSICONS_URL; ?>add_16.gif" 
										onclick="<?php echo 'document.getElementById(\''.$com->getId().'_editor_contacts\').submit();' ?>" /><br /><br /></td>
	</tr>
	<?php 
		$out = '';
		if($user->getUserContacts())
		{
			foreach($user->getUserContacts() as $contact)
			{
				$out .= '<tr class="items">';
				$out .= 	'<td class="first left">'.ucfirst($contact->getName()).'&nbsp;</td>';
				$out .= 	'<td class="left">'.ucfirst($contact->getLastName()).'&nbsp;</td>';
				$out .= 	'<td class="left">'.$contact->getEmail().'&nbsp;</td>';
				$out .= 	'<td class="left">'.$contact->getPhone().'&nbsp;</td>';
				$out .= 	'<td class="last center">';
				$out .= 	'<img title="'.ucfirst($txt->getWord('delete', $words).' '.$txt->getWord('contact', $words)).'" class="icon command" src="'.SYSICONS_URL.'delete_16.gif" onclick="deleteContactDialog('.$contact->getId().');" />';
				$out .= 	'</td>';
				$out .= '</tr>';
			}
		}
		else
		{
			$out  = '<tr class="items">';
			$out .= 	'<td class="first">&nbsp;</td>';
			$out .= 	'<td>'.ucfirst($txt->getWord('no_items', $words)).'</td>';
			$out .= 	'<td>&nbsp;</td>';
			$out .= 	'<td>&nbsp;</td>';
			$out .= 	'<td>&nbsp;</td>';
			$out .= 	'<td class="last center">&nbsp;</td>';
			$out .= '</tr>';
		}
		echo $out;
		?>
	</tbody>
</table>
</form>
<div id="delete_contact_dialog" title="<?php echo ucfirst($txt->getWord('delete', $words).' '.$txt->getWord('contact', $words)); ?>?" style="display:none; text-align:left;">
	<p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span><?php echo ucfirst($txt->getWord('sure_you_want_to_delete').' '.$txt->getWord('contact', $words)); ?></p>
</div>
<script type="text/javascript">
function deleteContactDialog(itemId)
{
	jQuery('#delete_contact_dialog').dialog('open');
	jQuery('#delete_contact_dialog').dialog({
		bgiframe: true,
		resizable: false,
		height:140,
		modal: true,
		overlay: 
		{
			backgroundColor: '#000',
			opacity: 0.5
		},
		buttons: 
		{
			'<?php echo ucfirst($txt->getWord('no', $words)); ?>': function() 
			{
				jQuery(this).dialog('close');
			},
			'<?php echo ucfirst($txt->getWord('delete', $words)).' '.getWord('ad_type', $words); ?>': function() 
			{
				jQuery('#delContact').val(itemId);
				
				jQuery(this).dialog('close');
				jQuery('#<?php echo $com->getId(); ?>_editor_contacts').submit();
			}
		}
	});
}
</script>